<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>InputEx - using XML, example with RSS</title>	

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../lib/yui/reset-fonts/reset-fonts.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../css/inputEx.css' />

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="css/demo.css"/>
<link rel="stylesheet" type="text/css" href="css/dpSyntaxHighlighter.css">
	
<script src="../lib/yui/utilities/utilities.js"></script>
<script src="../lib/XML/ObjTree.js"></script>
<script src="../build/inputex.js"></script>

</head>
<body>
	
	<div id="formContainer" class='exampleDiv'></div>
	
<script>

// Required for the UrlField and ListField
inputEx.spacerUrl = "../images/space.gif";

var rssFormDef = {
	type: 'group',
	parentEl: 'formContainer',
	fields: [
		{type: 'number', label: 'Version', name: '-version' },
		{
		   type: 'group',
			name: 'channel',
			fields: [
				{type: 'string', label: 'Title', name: 'title'},
				{type: 'string', label: 'Description', name: 'description'},
				{type: 'url', label: 'Link', name: 'link'},
				{type: 'select', label: 'Language', name: 'language', choices: ['en', 'fr']},
				{
				   type: 'list',
				   name: 'item',
				   useButtons: true,
				   elementType:{
					   type: 'group',
   					fields: [
   						{type: 'string', label: 'Title', name: 'title'},
   						{type: 'string', label: 'Description', name: 'description'},
   						{type: 'string', label: 'Link', name: 'link'}
   					]
				   }
				}
			]
		}
	]
};


YAHOO.util.Event.onDOMReady( function() {
	
		var rssForm = inputEx(rssFormDef);
		
		// Get the rss and populate the form
		YAHOO.util.Connect.asyncRequest('GET', 'rss-example.xml', {
			success: function(o) {
				var xotree = new XML.ObjTree();
			  var tree = xotree.parseXML( o.responseText );
				rssForm.setValue(tree.rss);
			}
		});
   
});
</script>
</body>
</html>
